﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace MangaManagerLib
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IMangaService
    {
        [OperationContract]
        [WebGet]
        IList<string> GetDataForChapter(string key, string url);
        [OperationContract]
        [WebGet]
        MangaStoryDetailContract GetMangaStoryDetail(string key, string url);
        [OperationContract]
        [WebGet]
        MangaCollectionContract GetMangaCollection(string key, string url, int page);
        [OperationContract]
        [WebGet]
        IList<BriefMangaInfoContract> GetNewestManga(string key, int number);
        [OperationContract]
        [WebGet]
        IList<BriefMangaInfoContract> GetPopularManga(string key, int number);
        [OperationContract]
        [WebGet]
        IList<BriefMangaInfoContract> SearchMangaByTitle(string key, string keysearch);
    }

    [DataContract]
    public class BriefMangaInfoContract
    {
        [DataMember]
        public string Link { get; set; }
        [DataMember]
        public string Title { get; set; }
        [DataMember]
        public string Status { get; set; }
        [DataMember]
        public string ImageLink { get; set; }
        [DataMember]
        public Chapter ChapterNewest { get; set; }
    }

    [DataContract]
    public class MangaStoryDetailContract : MangaStoryContract
    {
        [DataMember]
        public IList<MangaChapter> Chapters { get; set; }
    }
    [DataContract]
    public class MangaChapter
    {
        [DataMember]
        public string Link { get; set; }
        [DataMember]
        public string Title { get; set; }
        [DataMember]
        public string Date { get; set; }
    }
    [DataContract]
    public class MangaStoryContract
    {
        [DataMember]
        public string Link { get; set; }
        [DataMember]
        public string Title { get; set; }
        [DataMember]
        public string ImageLink { get; set; }
        [DataMember]
        public string Summary { get; set; }
        [DataMember]
        public string Author { get; set; }
        [DataMember]
        public string OtherName { get; set; }
        [DataMember]
        public string Genres { get; set; }
        [DataMember]
        public string Status { get; set; }
        [DataMember]
        public string Views { get; set; }
        [DataMember]
        public Chapter ChapterNewest { get; set; }
    }
    [DataContract]
    public class MangaCollectionContract
    {
        [DataMember]
        public int CurrentPage { get; set; }
        [DataMember]
        public int TotalPage { set; get; }
        [DataMember]
        public IList<MangaStoryContract> MangaList { get; set; }
    }
}
